{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "# 🔍 Airweave Search Tutorial\n",
    "\n",
    "Welcome to the comprehensive guide for using Airweave's powerful search functionality! This notebook will walk you through **14 practical examples** that demonstrate every major search feature, from basic queries to advanced AI-powered capabilities.\n",
    "\n",
    "## What You'll Learn\n",
    "\n",
    "- **Basic Search**: Simple queries with default settings\n",
    "- **Query Expansion**: AI-generated query variations for better recall\n",
    "- **Search Methods**: Hybrid vs Neural search approaches\n",
    "- **Filtering**: Structured filters to narrow down results\n",
    "- **Query Interpretation**: Natural language filtering (Beta)\n",
    "- **Temporal Relevance**: Boosting recent content\n",
    "- **Pagination**: Handling large result sets\n",
    "- **Score Filtering**: High-confidence results only\n",
    "- **AI Reranking**: Improving result quality\n",
    "- **AI Answer Generation**: Getting synthesized responses\n",
    "\n",
    "## Prerequisites\n",
    "\n",
    "Before running this notebook, make sure you have:\n",
    "\n",
    "1. **Installed the Airweave Python SDK**: `pip install airweave`\n",
    "2. **Your API key**: Get this from [Airweave Dashboard](https://app.airweave.ai/settings/api-keys)\n",
    "3. **A collection with data**: At least one collection with indexed content to search\n",
    "\n",
    "## Documentation Reference\n",
    "\n",
    "This tutorial is based on the official [Airweave Search Documentation](https://docs.airweave.ai/search).\n",
    "\n",
    "---\n",
    "\n",
    "**Ready to explore powerful search capabilities? Let's get started! 🚀**\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from datetime import datetime, timezone, timedelta\n",
    "from airweave import AirweaveSDK"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 🔧 Step 1: Setup - Initialize the Airweave Client\n",
    "\n",
    "First, we need to set up our connection to Airweave. Replace the placeholder values with your actual API key and collection ID."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"🔧 Setting up Airweave client...\")\n",
    "\n",
    "# Replace with your actual API key\n",
    "API_KEY = \"YOUR_API_KEY\"  # Get this from https://app.airweave.ai/settings/api-keys\n",
    "\n",
    "# Initialize the client\n",
    "client = AirweaveSDK(api_key=\"YOUR_API_KEY\")\n",
    "\n",
    "# Replace with your actual collection ID\n",
    "COLLECTION_ID = \"your-collection-id\"  # Find this in your Airweave dashboard\n",
    "\n",
    "print(f\"✅ Client initialized for collection: {COLLECTION_ID}\")\n",
    "print()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 🔍 Example 1: Basic Search - Simple Queries with Default Settings\n",
    "\n",
    "Let's start with the simplest search possible. This example shows how to perform a basic search using Airweave's default settings, which work great for most use cases."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"🔍 BASIC SEARCH EXAMPLES\")\n",
    "print(\"=\" * 50)\n",
    "\n",
    "print(\"Example 1: Simple search with default settings\")\n",
    "try:\n",
    "        results = client.collections.search(\n",
    "            readable_id=COLLECTION_ID,\n",
    "            query=\"customer feedback\"\n",
    "        )\n",
    "        print(f\"Found {len(results.results)} results\")\n",
    "      #  print(f\"First result: {results.results[0] if results.results else 'No results'}\")\n",
    "except Exception as e:\n",
    "        print(f\"Error: {e}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**What this example shows:**\n",
    "- How to perform a basic search with minimal configuration\n",
    "- The default search behavior (hybrid method with AI reranking)\n",
    "- How to handle search results and errors gracefully\n",
    "\n",
    "Try modifying the query to search for different terms in your collection!\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 🧠 Example 2: Query Expansion - Generate Variations of Your Query\n",
    "\n",
    "Sometimes your initial query might not capture all the relevant content. Query expansion uses AI to generate related search terms automatically, improving recall without requiring you to think of all possible variations."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"🧠 QUERY EXPANSION\")\n",
    "print(\"=\" * 50)\n",
    "\n",
    "print(\"Example 2: Using AI to expand queries for better recall\")\n",
    "try:\n",
    "    results = client.collections.search_advanced(\n",
    "     readable_id=COLLECTION_ID,\n",
    "            query=\"customer churn analysis\",\n",
    "            expansion_strategy=\"llm\"  # AI creates up to 4 query variations\n",
    "        )\n",
    "    print(f\"Expanded search found {len(results.results)} results\")\n",
    "    print(\"The AI automatically searches for related terms like:\")\n",
    "    print(\"- 'customer retention analysis'\")\n",
    "    print(\"- 'user attrition patterns'\")\n",
    "    print(\"- 'churn prediction models'\")\n",
    "except Exception as e:\n",
    "    print(f\"Error: {e}\")\n",
    "\n",
    "print()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**What this example shows:**\n",
    "- How AI automatically generates related search terms\n",
    "- The difference between basic and expanded search results\n",
    "- When to use query expansion for better recall\n",
    "\n",
    "The AI creates variations like \"customer retention analysis\" and \"user attrition patterns\" to find more relevant content!\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 🎯 Example 3-4: Search Methods - Choose How Airweave Searches Your Data\n",
    "\n",
    "Airweave offers different search methods, each optimized for different scenarios. Let's explore the two main approaches: **Hybrid** (combines AI and keyword matching) and **Neural** (pure AI understanding)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"🎯 SEARCH METHODS\")\n",
    "print(\"=\" * 50)\n",
    "    \n",
    "print(\"Example 3: Hybrid search (AI + keyword matching)\")\n",
    "try:\n",
    "        results = client.collections.search_advanced(\n",
    "            readable_id=COLLECTION_ID,\n",
    "            query=\"authentication flow security vulnerabilities\",\n",
    "            search_method=\"hybrid\"  # Best of both worlds\n",
    "        )\n",
    "        print(f\"Hybrid search found {len(results.results)} results\")\n",
    "        print(\"This combines semantic understanding with exact keyword matching\")\n",
    "except Exception as e:\n",
    "        print(f\"Error: {e}\")\n",
    "    \n",
    "print()\n",
    "    \n",
    "print(\"Example 4: Neural search (AI-powered semantic understanding)\")\n",
    "try:\n",
    "        results = client.collections.search_advanced(\n",
    "            readable_id=COLLECTION_ID,\n",
    "            query=\"user login problems\",\n",
    "            search_method=\"neural\"  # Pure AI understanding\n",
    "        )\n",
    "        print(f\"Neural search found {len(results.results)} results\")\n",
    "        print(\"This understands meaning, not just exact words\")\n",
    "except Exception as e:\n",
    "        print(f\"Error: {e}\")\n",
    "    \n",
    "print()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**What these examples show:**\n",
    "- **Hybrid search**: Combines AI understanding with exact keyword matching (recommended)\n",
    "- **Neural search**: Pure AI semantic understanding (great for conceptual queries)\n",
    "- Performance differences between search methods\n",
    "\n",
    "Choose hybrid for most use cases, neural for highly conceptual searches!\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 🔍 Example 5-7: Filtering - Narrow Down Results with Structured Filters\n",
    "\n",
    "When you have large datasets, filtering helps you find exactly what you need. These examples show how to filter by source, date ranges, and exclude unwanted results."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"🔍 FILTERING RESULTS\")\n",
    "print(\"=\" * 50)\n",
    "    \n",
    "print(\"Example 5: Filter by source (e.g., only GitHub issues)\")\n",
    "try:\n",
    "        results = client.collections.search_advanced(\n",
    "            readable_id=COLLECTION_ID,\n",
    "            query=\"deployment issues\",\n",
    "            filter={\n",
    "                \"must\": [{\n",
    "                    \"key\": \"source_name\",\n",
    "                    \"match\": {\"value\": \"GitHub\"}  # Case-sensitive!\n",
    "                }]\n",
    "            }\n",
    "        )\n",
    "        print(f\"GitHub-only search found {len(results.results)} results\")\n",
    "except Exception as e:\n",
    "        print(f\"Error: {e}\")\n",
    "    \n",
    "print()\n",
    "    \n",
    "print(\"Example 6: Multiple filters (source + date range)\")\n",
    "try:\n",
    "        # Search for recent customer feedback from specific sources\n",
    "        one_week_ago = (datetime.now(timezone.utc) - timedelta(days=7)).isoformat()\n",
    "        \n",
    "        results = client.collections.search_advanced(\n",
    "            readable_id=COLLECTION_ID,\n",
    "            query=\"customer feedback\",\n",
    "            filter={\n",
    "                \"must\": [\n",
    "                    {\n",
    "                        \"key\": \"source_name\",\n",
    "                        \"match\": {\"value\": \"Zendesk\"}\n",
    "                    },\n",
    "                    {\n",
    "                        \"key\": \"created_at\",\n",
    "                        \"range\": {\n",
    "                            \"gte\": one_week_ago\n",
    "                        }\n",
    "                    }\n",
    "                ]\n",
    "            }\n",
    "        )\n",
    "        print(f\"Recent feedback from support tools: {len(results.results)} results\")\n",
    "except Exception as e:\n",
    "        print(f\"Error: {e}\")\n",
    "    \n",
    "print()\n",
    "    \n",
    "print(\"Example 7: Exclude results (e.g., hide resolved tickets)\")\n",
    "try:\n",
    "        results = client.collections.search_advanced(\n",
    "            readable_id=COLLECTION_ID,\n",
    "            query=\"bug reports\",\n",
    "            filter={\n",
    "                \"must_not\": [{\n",
    "                    \"key\": \"status\",\n",
    "                    \"match\": {\"any\": [\"resolved\", \"closed\", \"done\"]}\n",
    "                }]\n",
    "            }\n",
    "        )\n",
    "        print(f\"Active bug reports only: {len(results.results)} results\")\n",
    "except Exception as e:\n",
    "        print(f\"Error: {e}\")\n",
    "    \n",
    "print()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "**What these examples show:**\n",
    "- **Source filtering**: Search only specific data sources (GitHub, Zendesk, etc.)\n",
    "- **Date filtering**: Find content from specific time periods\n",
    "- **Exclusion filtering**: Hide unwanted results (like resolved tickets)\n",
    "- **Multiple filters**: Combine different filter types\n",
    "\n",
    "Filters use structured syntax - check the Airweave docs for the complete filter reference!\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 🤖 Example 8: Query Interpretation - Let AI Extract Filters from Natural Language\n",
    "\n",
    "Instead of manually writing filter syntax, you can use natural language and let AI interpret your intent. This beta feature automatically converts phrases like \"open tickets from last week\" into proper filters."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"🤖 QUERY INTERPRETATION (Beta Feature)\")\n",
    "print(\"=\" * 50)\n",
    "    \n",
    "print(\"Example 8: Natural language filtering\")\n",
    "try:\n",
    "        results = client.collections.search_advanced(\n",
    "            readable_id=COLLECTION_ID,\n",
    "            query=\"open asana tickets from last week\",\n",
    "            enable_query_interpretation=True  # AI extracts filters automatically\n",
    "        )\n",
    "        print(f\"AI-interpreted search found {len(results.results)} results\")\n",
    "        print(\"The AI automatically understood:\")\n",
    "        print(\"- Source: Asana\")\n",
    "        print(\"- Status: open\")\n",
    "        print(\"- Time: last 7 days\")\n",
    "except Exception as e:\n",
    "        print(f\"Error: {e}\")\n",
    "    \n",
    "print()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**What this example shows:**\n",
    "- How AI interprets natural language queries\n",
    "- Automatic filter extraction from conversational phrases\n",
    "- The power of combining query interpretation with search\n",
    "\n",
    "This beta feature makes search more intuitive - just describe what you want in plain English!\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## ⏰ Example 9: Temporal Relevance - Prefer Newer Content\n",
    "\n",
    "For time-sensitive data, you can boost the relevance of recent content. This is particularly useful for news, support tickets, or any content where freshness matters."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"⏰ TEMPORAL RELEVANCE\")\n",
    "print(\"=\" * 50)\n",
    "print(\"Example 9: Boost recent content\")\n",
    "try:\n",
    "        results = client.collections.search_advanced(\n",
    "            readable_id=COLLECTION_ID,\n",
    "            query=\"project updates\",\n",
    "            recency_bias=0.7  # 0.0 = no bias, 1.0 = heavily prefer new\n",
    "        )\n",
    "        print(f\"Recent-biased search found {len(results.results)} results\")\n",
    "        print(\"Newer content gets higher scores\")\n",
    "except Exception as e:\n",
    "        print(f\"Error: {e}\")    \n",
    "print()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**What this example shows:**\n",
    "- How to boost recent content in search results\n",
    "- The `recency_bias` parameter (0.0 = no bias, 1.0 = heavily prefer new)\n",
    "- When temporal relevance matters for your use case\n",
    "\n",
    "Perfect for news, support tickets, or any time-sensitive content!\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 📄 Example 10: Pagination - Handle Large Result Sets\n",
    "\n",
    "When you have many results, pagination helps you navigate through them efficiently. This example shows how to retrieve results in pages using `limit` and `offset` parameters."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"📄 PAGINATION\")\n",
    "print(\"=\" * 50)\n",
    "print(\"Example 10: Paginated results\")\n",
    "try:\n",
    "        # First page\n",
    "        page1 = client.collections.search(\n",
    "            readable_id=COLLECTION_ID,\n",
    "            query=\"data retention policies\",\n",
    "            limit=10,\n",
    "            offset=0\n",
    "        )\n",
    "        \n",
    "        # Second page\n",
    "        page2 = client.collections.search(\n",
    "            readable_id=COLLECTION_ID,\n",
    "            query=\"data retention policies\",\n",
    "            limit=10,\n",
    "            offset=10  # Skip first 10 results\n",
    "        )\n",
    "        \n",
    "        print(f\"Page 1: {len(page1.results)} results\")\n",
    "        print(f\"Page 2: {len(page2.results)} results\")\n",
    "except Exception as e:\n",
    "        print(f\"Error: {e}\")\n",
    "    \n",
    "print()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**What this example shows:**\n",
    "- How to retrieve results in manageable chunks\n",
    "- Using `limit` to control page size\n",
    "- Using `offset` to navigate through pages\n",
    "- Building pagination logic for large datasets\n",
    "\n",
    "Essential for handling collections with thousands of documents!\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 🎯 Example 11: Score Filtering - Only High-Confidence Matches\n",
    "\n",
    "Sometimes you only want results that Airweave is very confident about. Score filtering lets you set a minimum confidence threshold, useful for compliance or when you need high-precision results."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"🎯 SCORE FILTERING\")\n",
    "print(\"=\" * 50)\n",
    "    \n",
    "print(\"Example 11: High-confidence results only\")\n",
    "try:\n",
    "        results = client.collections.search_advanced(\n",
    "            readable_id=COLLECTION_ID,\n",
    "            query=\"security vulnerability CVE-2024\",\n",
    "            score_threshold=0.8  # Only results with 80%+ confidence\n",
    "        )\n",
    "        print(f\"High-confidence results: {len(results.results)} matches\")\n",
    "        print(\"Useful for compliance or legal document retrieval\")\n",
    "except Exception as e:\n",
    "        print(f\"Error: {e}\")\n",
    "    \n",
    "print()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "**What this example shows:**\n",
    "- How to filter results by confidence score\n",
    "- The `score_threshold` parameter for precision control\n",
    "- When to use high-confidence filtering\n",
    "\n",
    "Great for compliance, legal documents, or when you need only the most relevant results!\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 🔄 Example 12: AI Reranking - Improve Result Quality\n",
    "\n",
    "AI reranking takes your initial results and uses advanced AI to reorder them for better relevance. While it adds latency (~10 seconds), it significantly improves the quality of your top results."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"🔄 AI RERANKING\")\n",
    "print(\"=\" * 50)\n",
    "    \n",
    "print(\"Example 12: AI-powered result reordering\")\n",
    "try:\n",
    "        results = client.collections.search_advanced(\n",
    "            readable_id=COLLECTION_ID,\n",
    "            query=\"user authentication methods\",\n",
    "            enable_reranking=True  # AI reviews and reorders results\n",
    "        )\n",
    "        print(f\"AI-reranked search found {len(results.results)} results\")\n",
    "        print(\"⚠️  Note: Reranking adds ~10 seconds of latency but improves accuracy\")\n",
    "except Exception as e:\n",
    "        print(f\"Error: {e}\")\n",
    "    \n",
    "print()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**What this example shows:**\n",
    "- How AI reranking improves result quality\n",
    "- The trade-off between accuracy and speed (+10 seconds latency)\n",
    "- When to enable reranking for better user experience\n",
    "\n",
    "Enable for critical searches, disable for real-time applications!\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 💬 Example 13: AI Answer Generation - Get Synthesized Responses\n",
    "\n",
    "Instead of just returning matching documents, Airweave can generate a synthesized answer based on your search results. This is perfect for question-answering scenarios where you want a direct response rather than a list of documents."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"💬 AI ANSWER GENERATION\")\n",
    "print(\"=\" * 50)\n",
    "    \n",
    "print(\"Example 13: Get AI-generated answers\")\n",
    "try:\n",
    "        results = client.collections.search_advanced(\n",
    "            readable_id=COLLECTION_ID,\n",
    "            query=\"What are our customer refund policies?\",\n",
    "            response_type=\"completion\"  # Get AI-generated answer\n",
    "        )\n",
    "        \n",
    "        if hasattr(results, 'completion') and results.completion:\n",
    "            print(\"AI Answer:\")\n",
    "            print(results.completion)\n",
    "        else:\n",
    "            print(\"No completion generated\")\n",
    "except Exception as e:\n",
    "        print(f\"Error: {e}\")\n",
    "    \n",
    "print()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**What this example shows:**\n",
    "- How to get AI-generated answers instead of raw documents\n",
    "- The `response_type=\"completion\"` parameter\n",
    "- When to use answer generation vs document retrieval\n",
    "\n",
    "Perfect for question-answering systems and chatbots!\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 🚀 Example 14: Complete Example - Everything Together\n",
    "\n",
    "Now let's combine all the features we've learned into one comprehensive search. This example demonstrates how to use multiple advanced features together for maximum search power."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"🚀 COMPLETE EXAMPLE\")\n",
    "print(\"=\" * 50)\n",
    "\n",
    "print(\"Example 14: Advanced search with all features\")\n",
    "try:\n",
    "    # Import the required filter classes\n",
    "    from airweave.models import Filter, FieldCondition, MatchAny\n",
    "    \n",
    "    results = client.collections.search_advanced(\n",
    "        readable_id=COLLECTION_ID,\n",
    "        query=\"customer feedback about pricing\",\n",
    "        expansion_strategy=\"llm\",           # AI query expansion\n",
    "        search_method=\"hybrid\",            # Best search method\n",
    "        filter=Filter(                     # Structured filtering\n",
    "            must=[FieldCondition(\n",
    "                key=\"source_name\",\n",
    "                match=MatchAny(any=[\"Zendesk\", \"Slack\"])\n",
    "            )]\n",
    "        ),\n",
    "        recency_bias=0.5,                 # Prefer recent content\n",
    "        score_threshold=0.7,              # High confidence only\n",
    "        enable_reranking=True,            # AI reranking\n",
    "        response_type=\"raw\",              # Raw results\n",
    "        limit=50,                         # Pagination\n",
    "        offset=0\n",
    "    )\n",
    "    \n",
    "    print(f\"Advanced search completed!\")\n",
    "    print(f\"Results: {len(results.results)}\")\n",
    "    print(\"This example demonstrates:\")\n",
    "    print(\"- AI query expansion\")\n",
    "    print(\"- Hybrid search method\")\n",
    "    print(\"- Source filtering\")\n",
    "    print(\"- Recency bias\")\n",
    "    print(\"- Score threshold\")\n",
    "    print(\"- AI reranking\")\n",
    "    print(\"- Pagination\")\n",
    "    \n",
    "except Exception as e:\n",
    "    print(f\"Error: {e}\")\n",
    "    print(\"Note: This example requires proper filter imports and valid data\")\n",
    "\n",
    "print()\n",
    "print(\"🎉 Tutorial completed! You now know how to use Airweave search effectively.\")\n",
    "print()\n",
    "print(\"Next steps:\")\n",
    "print(\"1. Try these examples with your own data\")\n",
    "print(\"2. Experiment with different parameters\")\n",
    "print(\"3. Check out the interactive API docs: https://docs.airweave.ai/api-reference\")\n",
    "print(\"4. Read our blog for advanced tips: https://airweave.ai/blog\")\n",
    "\n",
    "\n",
    "# ============================================================================\n",
    "# HELPER FUNCTIONS & TIPS\n",
    "# ============================================================================\n",
    "\n",
    "def print_search_tips():\n",
    "    \"\"\"\n",
    "    Print helpful tips for using Airweave search effectively.\n",
    "    \"\"\"\n",
    "    print(\"💡 SEARCH TIPS\")\n",
    "    print(\"=\" * 50)\n",
    "    print(\"1. Start simple: Use basic search first, then add complexity\")\n",
    "    print(\"2. Use hybrid search for best results (default)\")\n",
    "    print(\"3. Enable AI reranking for accuracy, disable for speed\")\n",
    "    print(\"4. Use filters to narrow down large datasets\")\n",
    "    print(\"5. Try query interpretation for natural language queries\")\n",
    "    print(\"6. Adjust recency_bias based on your data's time sensitivity\")\n",
    "    print(\"7. Use score_threshold for high-confidence results only\")\n",
    "    print(\"8. Paginate through large result sets\")\n",
    "    print()\n",
    "\n",
    "def print_default_settings():\n",
    "    \"\"\"\n",
    "    Print Airweave's default search settings for reference.\n",
    "    \"\"\"\n",
    "    print(\"⚙️  DEFAULT SETTINGS\")\n",
    "    print(\"=\" * 50)\n",
    "    print(\"| Feature                | Default | Description\")\n",
    "    print(\"|------------------------|---------|----------------------------\")\n",
    "    print(\"| Query Expansion        | auto    | AI expansion when available\")\n",
    "    print(\"| Search Method          | hybrid  | AI + keyword matching\")\n",
    "    print(\"| Query Interpretation  | Off     | Manual filter control\")\n",
    "    print(\"| AI Reranking          | On      | Improves quality (+10s)\")\n",
    "    print(\"| Recency Boost         | 0.3     | Slight preference for new\")\n",
    "    print(\"| Score Filter          | None    | Return all matches\")\n",
    "    print(\"| Response Format       | raw     | Actual documents\")\n",
    "    print()\n",
    "\n",
    "# Call the helper functions to show tips\n",
    "print_search_tips()\n",
    "print_default_settings()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
